﻿Public Class BlockFiveHomeworkSectionSix
    Dim QuestionNumber As Integer
    Dim dtmTest, dtmTest2 As Date
    Dim filename As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    'Declare the Array as 10 rows and 3 columns
    Dim ArrayMax As Integer = 33 'One number past the end of actual info in array
    Dim HWQuestions(ArrayMax, 7) As String
    Dim intResponse As Integer
    Dim intQuestionCount As Integer = 0
    Dim intAnswerCount As Integer = 0
    Dim intReferenceCount As Integer = 0
    Dim intFirstRun As Integer = 1
    Dim strUser As String = "Enter Last Name"
    Dim strAnswer, strAnswer2, strAnswer3, strAnswer4, strAnswer5, _
     strAnswer6, strAnswer7, strAnswer8, strAnswer9, strAnswer10, strAnswer11, _
     strAnswer12, strAnswer13, strAnswer14, strAnswer15, strAnswer16, _
     strAnswer17, strAnswer18, strAnswer19, strAnswer20, strAnswer21, _
     strAnswer22, strAnswer23, strAnswer24, strAnswer25, strAnswer26, _
     strAnswer27, strAnswer28, strAnswer29, strAnswer30, strAnswer31 As String
    Dim intChoiceACount As Integer = 2
    Dim intChoiceBCount As Integer = 3
    Dim intChoiceCCount As Integer = 4
    Dim intChoiceDCount As Integer = 5

    Shared Property MidiParent As MainForm

    Private Sub CloseToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles CloseToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub BlockTwoHomeworkSectionOne_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        txtObj.Text = "Objectives:" + vbCrLf + "- Working in groups of two using appropriate tools, test equipment, technical data and an AN/FSC 127, perform prescribed maintenance tasks with no more than two instructor assists." _
                                    + vbCrLf + "- Working in groups of two using appropriate tools, test equipment, technical data and an AN/FSC 127, troubleshoot the ETVS down to the LRU with no more than two instructor assists."
        If (System.IO.File.Exists(filename & "\Homework\Block 5\Block 5 Section 6.txt")) Then
            intResponse = MsgBox("This assignment has already been completed.  Are you sure you want to delete the current assignment and reaccomplish it?", 4, "Confirm Assignment Deletion")
            If intResponse = MsgBoxResult.Yes Then
                System.IO.File.Delete(filename & "\Homework\Block 5\Block 5 Section 6.txt")
                System.IO.File.Create(filename & "\Homework\Block 5\Block 5 Section 6.txt").Dispose()
            ElseIf intResponse = MsgBoxResult.No Then
                Me.Close()
            End If
        End If
        If (Not System.IO.File.Exists(filename & "\Homework\Block 5\Block 5 Section 6.txt")) Then
            System.IO.File.Create(filename & "\Homework\Block 5\Block 5 Section 6.txt").Dispose()
        End If
        If (Not System.IO.File.Exists(filename & "\Instructor\Block 5\Block 5 Section 6.txt")) Then
            System.IO.File.Create(filename & "\Instructor\Block 5\Block 5 Section 6.txt").Dispose()
        End If
        strUser = InputBox("Please enter last name", strUser)
        If strUser Is "" Then
            Me.Close()
        End If
        '************************************************
        '****** Questions Are Loaded Here****************
        '******* Column 1 is Questions (Preloaded)*******
        '******* Column 2 is Accepts Students Answer*****
        '******* Column 3 is Reference ******************

        HWQuestions(1, 1) = "1. TI 6650.53A, Section _____, contains recommended maintenance procedures, a troubleshooting guide, and corrective maintenance instructions."
        HWQuestions(1, 2) = strAnswer
        HWQuestions(1, 3) = "Reference"

        HWQuestions(2, 1) = "2. Circuit cards used in the ETVS equipment racks are composed primarily of _______________ devices that are subject to damage by ESD.."
        HWQuestions(2, 2) = strAnswer2
        HWQuestions(2, 3) = "Reference"

        HWQuestions(3, 1) = "3. All personnel handling ESD-sensitive devices should be grounded with a _______________."
        HWQuestions(3, 2) = strAnswer3
        HWQuestions(3, 3) = "Reference"

        HWQuestions(4, 1) = "4. After removal from the protective bags or the card cage, always hold the circuit cards by the __________ and the __________ of the card."
        HWQuestions(4, 2) = strAnswer4
        HWQuestions(4, 3) = "Reference"

        HWQuestions(5, 1) = "5. Work surfaces must be grounded through a __________ resistor to limit any current should an energized circuit come in contact with the surface."
        HWQuestions(5, 2) = strAnswer5
        HWQuestions(5, 3) = "Reference"

        HWQuestions(6, 1) = "1. Coordinate with the ATC _______________ whenever a maintenance event will take equipment units off-line."
        HWQuestions(6, 2) = strAnswer6
        HWQuestions(6, 3) = "Reference"

        HWQuestions(7, 1) = "2. TED The performance check for the Power Supply Module may be located by referencing TI 6650.53A, paragraph __________."
        HWQuestions(7, 2) = strAnswer7
        HWQuestions(7, 3) = "Reference"

        HWQuestions(8, 1) = "3. The performance test for the E&M Interface may be located by referencing TI 6650.53A, paragraph __________."
        HWQuestions(8, 2) = strAnswer8
        HWQuestions(8, 3) = "Reference"

        HWQuestions(9, 1) = "4. ETVS interface card alignments are found in TI 6650.53A, paragraph __________."
        HWQuestions(9, 2) = strAnswer9
        HWQuestions(9, 3) = "Reference"

        HWQuestions(10, 1) = "5. The __________ is the point in a communications circuit to which all relative levels at other points in the circuit are referred."
        HWQuestions(10, 2) = strAnswer10
        HWQuestions(10, 3) = "Reference"

        HWQuestions(11, 1) = "6. The 0 TLP in the ETVS is __________ dBm."
        HWQuestions(11, 2) = strAnswer11
        HWQuestions(11, 3) = "Reference"

        HWQuestions(12, 1) = "7. _____ is a change in level from the established 0 TLP reference."
        HWQuestions(12, 2) = strAnswer12
        HWQuestions(12, 3) = "Reference"

        HWQuestions(13, 1) = "8. If we measure -8 dBm at a point, and we know our established 0 TLP is -10 dBm, the difference between our reading and 0 TLP is __________."
        HWQuestions(13, 2) = strAnswer13
        HWQuestions(13, 3) = "Reference"

        HWQuestions(14, 1) = "9. __________ is a relative power level which is referenced to the 0 TLP."
        HWQuestions(14, 2) = strAnswer14
        HWQuestions(14, 3) = "Reference"

        HWQuestions(15, 1) = "10. dBm0 can be converted to dBm using what formula?"
        HWQuestions(15, 2) = strAnswer15
        HWQuestions(15, 3) = "Reference"

        HWQuestions(16, 1) = "11. If we have a site specific level of -8 dBm from the radio receiver, what would be the correct level to inject during VOX testing?"
        HWQuestions(16, 2) = strAnswer16
        HWQuestions(16, 3) = "Reference"""

        HWQuestions(17, 1) = "1. With the exception of fuses, troubleshooting is limited to the isolation of a fault to the __________."
        HWQuestions(17, 2) = strAnswer17
        HWQuestions(17, 3) = "Reference"

        HWQuestions(18, 1) = "2. There are two central failure alarms: the __________ unit and the __________________ in the Central Equipment Rack."
        HWQuestions(18, 2) = strAnswer18
        HWQuestions(18, 3) = "Reference"

        HWQuestions(19, 1) = "3. If a fuse blows in the system, an audible alarm is generated on the ____________ card."
        HWQuestions(19, 2) = strAnswer19
        HWQuestions(19, 3) = "Reference"

        HWQuestions(20, 1) = "4. The ____________________ provides a centralized location in the Central Equipment Rack for all system alarm indications."
        HWQuestions(20, 2) = strAnswer20
        HWQuestions(20, 3) = "Reference"

        HWQuestions(21, 1) = "5. When a possibly defective card is detected, an operational __________ should be substituted to determine whether the card was, in fact, defective."
        HWQuestions(21, 2) = strAnswer11
        HWQuestions(21, 3) = "Reference"

        HWQuestions(22, 1) = "6. The replacement card must be checked to ensure that the correct ___________ has been installed.."
        HWQuestions(22, 2) = strAnswer22
        HWQuestions(22, 3) = "Reference"

        HWQuestions(23, 1) = "7. If a unit fails, an alarm sounds to signal the user, and the ____________________ screen appears on the SCT."
        HWQuestions(23, 2) = strAnswer23
        HWQuestions(23, 3) = "Reference"

        HWQuestions(24, 1) = "8. The SCT provides the capability to perform _____________ and _____________ tests to devices in the 'Maintenance Busy' mode."
        HWQuestions(24, 2) = strAnswer24
        HWQuestions(24, 3) = "Reference"

        HWQuestions(25, 1) = "9. What does the 'Happy Face' on the SCT Status Bar indicate?."
        HWQuestions(25, 2) = strAnswer25
        HWQuestions(25, 3) = "Reference"

        HWQuestions(26, 1) = "10. At the SCT, the __________ key may be pressed to silence an alarm."
        HWQuestions(26, 2) = strAnswer26
        HWQuestions(26, 3) = "Reference"

        HWQuestions(27, 1) = "11. The Monitoring and Loop Back tests are set up and run at the _________."
        HWQuestions(27, 2) = strAnswer27
        HWQuestions(27, 3) = "Reference"

        HWQuestions(28, 1) = "12. If the Gateway/SCT goes down, the Gateway Server icon will turn __________."
        HWQuestions(28, 2) = strAnswer28
        HWQuestions(28, 3) = "Reference"

        HWQuestions(29, 1) = "13. Tables’ _____ through _____ present troubleshooting indications which are observable at the front panels of important system cards."
        HWQuestions(29, 2) = strAnswer29
        HWQuestions(29, 3) = "Reference"

        HWQuestions(30, 1) = "14. Table 6-36 is divided into three sections, each of which addresses a particular category of reported faults, which are listed as follows:"
        HWQuestions(30, 2) = strAnswer30
        HWQuestions(30, 3) = "Reference"

        HWQuestions(31, 1) = "15. The Operator Processor reports 'Down'. In what figure does the specified flowchart begin?"
        HWQuestions(31, 2) = strAnswer31
        HWQuestions(31, 3) = "Reference"

        HWQuestions(32, 1) = "Close"

        Next_Question(HWQuestions)
    End Sub

    Private Sub btnNextQuestion_Click(sender As System.Object, e As System.EventArgs) Handles btnNextQuestion.Click
        Next_Question(HWQuestions)
    End Sub
    Private Sub Clear_Display()
        txtQuestion.Clear()
        txtAnswer.Clear()
    End Sub

    Public Function Next_Question(HWQuestions As String(,))
        txtAnswer.Focus()
        If intQuestionCount > 0 Then
            WriteToFile()
        End If
        If btnNextQuestion.Text = "Done" Then
            Me.Close()
            OpenResults()
        End If
        intQuestionCount = intQuestionCount + 1
        LabelChangeCheck()
        If intQuestionCount = 31 Then
            btnNextQuestion.Text = "Done"
        End If
        txtQuestion.Text = HWQuestions(intQuestionCount, 1)
        intAnswerCount = intAnswerCount + 1
        HWQuestions(intAnswerCount, 2) = txtAnswer.Text
        intReferenceCount = intReferenceCount + 1
        txtReference.Text = HWQuestions(intReferenceCount, 3)

        Return intQuestionCount & intAnswerCount
    End Function

    Private Sub LabelChangeCheck()
        If intQuestionCount = 1 Then
            lblSubject.Text = "Electrostatic Discharge"
        ElseIf intQuestionCount = 6 Then
            lblSubject.Text = "System Performance Checks"
        ElseIf intQuestionCount = 17 Then
            lblSubject.Text = "Troubleshooting"
        End If
    End Sub

    Private Sub WriteToFile()
        Dim Integrity As String = (filename & "\Instructor\Block 5\Block 5 Section 6.txt")
        Dim Results As String = (filename & "\Homework\Block 5\Block 5 Section 6.txt")

        '***********Output to hidden file for Instructor Check***********
        If System.IO.File.Exists(Integrity) = True Then
            Dim hiddenWriter As New System.IO.StreamWriter(Integrity, True)
            If intQuestionCount = 1 Then
                hiddenWriter.WriteLine()
                hiddenWriter.WriteLine("Student: " & strUser)
                hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.WriteLine("Question:" & txtQuestion.Text)
            hiddenWriter.WriteLine("Answer:" & txtAnswer.Text)
            hiddenWriter.WriteLine("Reference: " & txtReference.Text)
            hiddenWriter.WriteLine()
            If intQuestionCount = 31 Then
                hiddenWriter.WriteLine("Block 5 Section 6 Homework Complete")
                hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.Close()

            'MsgBox("Text written to file")
        Else
            MsgBox("File Does Not Exist Integrity")
        End If

        '******Output to file for Student to review***********
        If System.IO.File.Exists(Results) = True Then
            Dim hiddenWriter As New System.IO.StreamWriter(Results, True)
            If intQuestionCount = 1 Then
                hiddenWriter.WriteLine("- " & txtObj.Text)
                hiddenWriter.WriteLine()
                hiddenWriter.WriteLine("Student: " & strUser)
                hiddenWriter.WriteLine()
                'hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                'hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            If intQuestionCount = 1 Then
                hiddenWriter.WriteLine(lblSubject.Text)
            ElseIf intQuestionCount = 6 Then
                hiddenWriter.WriteLine(lblSubject.Text)
            ElseIf intQuestionCount = 17 Then
                hiddenWriter.WriteLine(lblSubject.Text)
            End If
            hiddenWriter.WriteLine("Question:" & txtQuestion.Text)
            hiddenWriter.WriteLine("Answer:" & txtAnswer.Text)
            'hiddenWriter.WriteLine("Reference: " & txtReference.Text)
            hiddenWriter.WriteLine()
            If intQuestionCount = 31 Then
                hiddenWriter.WriteLine("Block 5 Section 6 Homework Complete")
                'hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                'hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.Close()

            'MsgBox("Text written to file")
        Else
            MsgBox("File Does Not Exist Results")
        End If

        If intQuestionCount > 0 Then
            txtAnswer.Clear()
        End If

    End Sub

    Private Sub OpenResults()
        Dim p As Process = Process.Start(filename & "\Homework\Block 5\Block 5 Section 6.txt")
    End Sub
End Class
